package com.universe.impl;

import javax.swing.JFrame;

public class Canvas extends JFrame {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private UniverseAdapter uad;
	
	public Canvas(){
		super("N-Body Pane");
		this.setSize(1000, 1000);
		this.uad = new UniverseAdapter(1000, 1000);
		this.add(uad);
		this.setVisible(true);
		this.setDefaultCloseOperation(EXIT_ON_CLOSE);
		refresh();
	}
	
	private void refresh(){
		while(true){
			try {
				Thread.sleep(20);
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			uad.step();
			uad.repaint();
		}
	}
	
}
